//index.js
//获取应用实例
const app = getApp();
const SERVICE = require("../../service.js");
const URL = SERVICE.URL;

Page({
  data:{
    showAnnouncement:false,
    Announcement:{
      quit:"AnnouncementQuit"
    }
  },
  onLoad(){

  },
  ChangingSilder(e) {
    let silder_val = e.detail.value;
    console.log(silder_val);
  },
  announcement(){
    this.setData({
      showAnnouncement: true
    });
  },
  AnnouncementQuit(){
    this.setData({
      showAnnouncement: false
    });
  },
  Discren() {
    let _this = this;
    wx.showActionSheet({
      itemList: ['从相册中选择', '拍照'],
      itemColor: "#f7982a",
      success: function (res) {
        if (!res.cancel) {
          let tapIndex = res.tapIndex;
          if (tapIndex == 0) {
            _this.chooseWxImage("album");
          } else if (tapIndex == 1) {
            _this.chooseWxImage("camera");
          }
        }
      }
    })
  },
  chooseWxImage(type) {
    wx.chooseImage({
      sizeType: ['original', 'compressed'],
      sourceType: [type],
      success: function (res) {
        let tempFilePath = res.tempFilePaths[0];
        wx.navigateTo({
          url: "../image-recognition/image-recognition?imgUrl=" + tempFilePath,
        });
      },
    })
  },
});